package com.wolfking.jeesite.mybatis;

public class CurrentLoginUserThreadLocal {

    private static final InheritableThreadLocal<Integer> userThreadLocal = new InheritableThreadLocal<>();


    public static void setLoginUserId(Integer userId) {
        userThreadLocal.set(userId);
    }

    public static int getLoginUserId() {
        Integer integer = userThreadLocal.get();
        if (integer == null) {
            integer = -1;
        }
        return integer;
    }

    public static void removeLoginUserId(){
        userThreadLocal.remove();
    }
}
